package com.itheima02;

public class EatableDemo {
    public static void main(String[] args) {
        // 主方法中调用此方法
        Eatable e = new EatableImpl();
        useEatable(e);

        // 匿名内部类改进
        useEatable(new Eatable() {
            @Override
            public void eat() {
                System.out.println("吃苹果");
            }
        });

        // Lambda 表达式改进
        useEatable(() -> {
            System.out.println("吃苹果");
        });
    }

    private static void useEatable(Eatable e) {
        e.eat();
    }
}
